When editing a text document, it is sometimes useful to replace a particular character pattern (e.g., one or more characters, a word, or group of words) with another. In some cases, a word may be consistently misspelled throughout a document and needs to be replaced with its correct spelling. In other cases, an original word choice used consistently throughout a document may be stylistically poor and can be improved by replacement with a better choice. In still others, common punctuation or formatting errors (e.g., a single space after a period) may require replacement with the correct character pattern (e.g., period, double space). Making these kinds of global changes to a document manually can prove to be tedious, time consuming, and subject to human error.
Some prior word processors provide a find and replace editing tool to automate the task of replacing one character pattern with another. In general, these tools allow a user to specify a particular combination of characters (a "find pattern") to be searched for in a text document, and a particular combination of characters (a "replacement pattern") which is to replace the find pattern. Some prior find and replace editing tools allow the user optionally to include search qualifiers, such as wildcard characters, to specify limited variations of the find and/or replacement patterns. Typically, the user also can specify whether to replace occurrences of the find pattern one at a time (to confirm each replacement), or all at once. Employing a string search algorithm, the find and replace tool searches the text of the document for any occurrence of the find pattern in a forward or backward direction starting from a particular location (e.g., current insertion point), or within a selected text block. When an occurrence of the find pattern is located, the tool replaces the occurrence with the replacement pattern.
Most words have various inflected forms to indicate certain grammatical relationships, such as number, case, gender, tense, etc. This can create a problem when replacing one word choice with another. In typical prior find and replace editing tools, only a fixed find pattern and fixed replacement pattern can be specified. Accordingly, with these prior find and replace editing tools, each inflected form of the words must be separately replaced. Since the user is responsible for separately initiating replacement of each inflected form, the task of replacing one word choice for another therefore is slow and subject to human error.
Some prior find and replace editing tools provide pattern matching features which allow some limited variations of the find and replacement patterns to be specified using search qualifiers. A user potentially can construct find and replacement patterns to replace inflected forms of one word choice with another in a single find and replace editing operation, by using search qualifiers to specify variations of the patterns for each of the word choices' inflected forms. However, the search qualifiers generally are difficult for the average user to learn and use. Since the variations of the find and replacement patterns would have to be specified in exacting detail, constructing such find and replacement patterns would require exact knowledge of the word choices' inflected forms, and would be difficult, error prone, and time consuming for even sophisticated users.
One prior word processor, Novell's WordPerfect version 6.1 for Windows word processor ("WordPerfect 6.1"), has a find and replace editing tool which provides a "word forms" option. When this option is selected, the find and replace editing tool replaces inflected forms of a find word with corresponding inflected forms of a replacement word (i.e., the find word is "morphologically" replaced with the replacement word). To specify the find and replacement words, the user can enter any inflected form of these words. For example, when "run" is specified as the find word and "walk" as the replacement word, an occurrence of an inflected form of run (i.e., run, runs, ran, and running) in the text document is replaced with the corresponding inflected form of walk (i.e., walk, walks, walked, and walking, respectively). The user optionally can choose to replace all occurrences of the inflected forms of the find word. The word forms option makes the task of replacing one word choice with another simpler and quicker, since the user need not account for nor separately initiate replacement of each inflected form of the words.
The word forms option of the WordPerfect 6.1 find and replace editing tool has a number of drawbacks, one of which is that it fails to resolve a number of common ambiguous situations. One such ambiguous situation arises from the fact that there are many words which are inflected forms of more than one base or root word. For example, the word "saw" is an inflected form of two root words, i.e., a noun singular form of root word "saw" (meaning a tool for cutting wood) and a past tense verb of root word "to see" (meaning to perceive visually). When such a word (which is an inflected form of multiple base words) is specified as the find or replace word, it is unclear which base word is intended by the user. The WordPerfect 6.1 find and replace editing tool fails to resolve this ambiguity. When a specified find or replace word is an inflected form of multiple base words, the WordPerfect 6.1 find and replace editing tool (with word forms option selected) finds and replaces inflected forms of all the multiple base words.
Another ambiguous situation results from the fact that many base words have inflected forms which constitute more than one part of speech. For example, the word "sheep" is both a singular and plural noun. Other words have separate inflected forms for singular and plural nouns (e.g., "goat" and "goats"). Additionally, some words have multiple plural forms (e.g., "thesauri" and "thesauruses"). As a result, one inflected form of the find word may correspond to multiple inflected forms of the replacement word. Again, the WordPerfect 6.1 find and replace editing tool (with word forms option selected) fails to resolve the ambiguity. When an inflected form of the find word corresponds to multiple inflected forms of the replacement word, the user is presented with a list of the multiple corresponding inflected forms of the replacement word from which to select. The first word form in the list is presented to the user as a default selection, which the user can select by pressing the "return" key. Alternatively, the user can select another of the word forms with the "arrow" keys or mouse. This considerably slows the task of replacing word choices.
The failure of the find and replace editing tool in WordPerfect 6.1 to resolve many ambiguous situations can prove particularly destructive when the user chooses to replace all occurrences of the find word (rather than replacing one occurrence at a time so as to confirm replacement). Due to the unresolved ambiguities, choosing to replace all occurrences may have results that are neither intended nor expected by the user. For example, replacing all occurrences of "saw" with "hammer" (with intent to replace inflected forms of their noun base words) has the unintended consequence of also replacing verb forms of "to see" with verb forms of "to hammer" (e.g., "seen" with "hammered"). Further, when there are multiple matching inflected forms, WordPerfect 6.1's find and replace tool selects the default first word form in the corresponding inflected word forms list without user confirmation. These results can be very difficult for the user to foresee and correct.
An object of the invention is to prevent user errors by automating replacement of word choices.
Another object of the invention is to provide an editing tool that morphologically replaces a user-specified find word with a user-specified replacement word in an efficient manner.
Yet another object of the invention is to provide an editing tool for morphologically finding and replacing words so as to resolve ambiguities resulting from a user-specified find or replace word having multiple root words, and from an inflected form of one of the find or replace words corresponding to multiple inflected forms of another of the find or replace words.
A further object of the invention is to help prevent unintended or destructive consequences to the user's text document when morphologically finding and replacing words.